<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Access-Control-Allow-Origin" content="oapi.dingtalk.com">
    <title>谢秀轩</title>
    <script src="../jquery-3.3.1.min.js"></script>
    <style>
        #app {
            width: 500px;
            height: 600px;
            text-align: center;
            margin: 0 auto;
        }
        
        body {
            text-align: center;
        }
    </style>
</head>

<body>
    <h1>何佳龙操作</h1>
    <div id="app">
        <textarea name="text11" id="" cols="30" rows="10" v-model='intext'></textarea>
        <br>
        <button v-on:click='go'>发送</button>
    </div>
    <script src="../vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                intext: ""
            },
            methods: {
                go: function() {
                    $.ajax({
                        type: 'POST',
                        url: 'https://oapi.dingtalk.com/robot/send?access_token=604d86002b4a8cb4a4a34368818de87f108a033c2cc20ae183a2bc49d07ec7c9',
                        beforeSend: function(xhr) {
                            xhr.setRequestHeader('Content-Type', 'application/json');
                        },
                        data: JSON.stringify({
                            "msgtype": "text",
                            "text": {
                                "content": this.intext
                            }
                        }),
                        success: function(data) {
                            alert("发送成功");
                        },
                        error: function(d, msg) {
                            alert("error");
                        }
                    })
                }
            }
        })
    </script>
</body>

</html>